package com.breeze.components.mybatis.page;

import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.validation.constraints.Max;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author breeze
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class AbstractPageQuery<T> extends AbstractQuery {

  public static final int MAX_PAGE_NUM = 200;
  public static final int MAX_PAGE_SIZE = 500;
  public static final int DEFAULT_PAGE_SIZE = 10;

  @Max(MAX_PAGE_NUM)
  protected Integer pageNum = 1;

  @Max(MAX_PAGE_SIZE)
  protected Integer pageSize = 10;

  public Page<T> toPage() {
    return new Page<>(pageNum, pageSize);
  }

  @Override
  public QueryWrapper addQueryCondition() {
    return null;
  }
}
